<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .btn{
            display: inline-block;
            margin-bottom: 0;
            font-weight: 400;
            text-align: center;
            white-space: nowrap;
            vertical-align: middle;
            -ms-touch-action: manipulation;
            touch-action: manipulation;
            cursor: pointer;
            background-image: none;
            border: 1px solid transparent;
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            border-radius: 4px;
        }

        .primary{
            background: rgb(53, 135, 212);
            color:white;
        }
        .danger{
            background-color: rgb(184, 81, 81);
            color:white;
        }
    </style>
</head>
<body>
    
    <div id="root"></div>

    <script src="../js/react.development.js"></script>
    <script src="../js/react-dom.development.js"></script>
    <script src="../js/babel.min.js"></script>
    <script type="text/babel">
        /**
         * <Button type="primary">按钮</Button>
         * <Button type="danger">你好</Button>
         */
        class Button extends React.Component{
            render(){
                //获取 type 属性的值
                let {type, children} = this.props; 
                return <button className={"btn " + type}>{children}</button>
            }
        }

        ReactDOM.render(<Button type="danger">礼拜六</Button>, document.querySelector("#root"));

    </script>
</body>
</html>